<?php
$articleTable = Zend_Registry::get('database')->article;
$articleList = $this->articleList;
$type = $this->type;
$typeMap = Zend_Registry::get('config')->menu;
?>
<?php 
if (APPLICATION_ENV == 'production' && !APPLICATION_DEBUG) {
?>
<link media="screen" type="text/css"
	href="<?php
echo CSS_MIN_PATH;
?>/style_organic.css"
	rel="stylesheet">
<link media="screen" type="text/css"
	href="<?php
echo CSS_MIN_PATH;
?>/mvc-current.css"
	rel="stylesheet">
<?php 
} else {
?>
<link media="screen" type="text/css"
	href="<?php
echo CSS_SOURCE_PATH;
?>/style_organic.css"
	rel="stylesheet">
<link media="screen" type="text/css"
	href="<?php
echo CSS_SOURCE_PATH;
?>/mvc-current.css"
	rel="stylesheet">
<?php 
}

if ($type === $typeMap->magazine || $type == $typeMap->mix) {
    if (APPLICATION_ENV == 'production' && !APPLICATION_DEBUG) {
    ?>
    <link media="screen" type="text/css"
    	href="<?php echo CSS_MIN_PATH;?>/magazine.css"
    	rel="stylesheet">
    <?php 
    } else {
    ?>
    <link media="screen" type="text/css"
    	href="<?php echo CSS_SOURCE_PATH;?>/magazine.css"
    	rel="stylesheet">
    <?php 
    }
}

if ($type === $typeMap->music || $type === $typeMap->mix) {
    $localMusic = array();
    $audioPlayerCount = 1;
    ?>
<script type="text/javascript"
	src="<?php
    echo APPLICATION_PUBLIC;
    ?>/js/audio-player.min.js"></script>
<script type="text/javascript">
AudioPlayer.setup(
	"http://www.sundtrak.com/wp-content/plugins/audio-player/assets/player.swf?ver=2.0.4.1", 
	{
		width:"650",
		animation:"yes",
		encode:"yes",
		initialvolume:"60",
		remaining:"no",
		noinfo:"no",
		buffer:"5",
		checkpolicy:"no",
		rtl:"no",
		bg:"E5E5E5",
		text:"333333",
		leftbg:"CCCCCC",
		lefticon:"333333",
		volslider:"666666",
		voltrack:"FFFFFF",
		rightbg:"B4B4B4",
		rightbghover:"999999",
		righticon:"333333",
		righticonhover:"FFFFFF",
		track:"FFFFFF",
		loader:"009900",
		border:"CCCCCC",
		tracker:"DDDDDD",
		skip:"666666",
		pagebg:"FFFFFF",
		transparentpagebg:"yes"
	}
);
</script>
<?php
}
?>
<script type="text/javascript"
	src="<?php echo APPLICATION_PUBLIC;?>/js/jquery.cycle.all.min.js"></script>
<style type="text/css">
.ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; *line-height: 0; }
.ir br { display: none; }
</style>
<div id="container">
	<div id="contentarchive">
		<div class="iloveline">
			<div style="margin: 15px 0 15px 0;font-family:'FuturaPTLight-Reg', sans-serif;">
                <?php
                echo $this->breadcrumb;
                ?>
            </div>
		</div>
        <?php
        foreach ($articleList as $article) {
            if ($article[$articleTable->type] != $typeMap->magazine) {
                ?>
        <div class="postarea">
			<h2>
				<a
					href="<?php
                echo APPLICATION_URL;
                ?>/article/index/p/<?php
                echo $article[$articleTable->id];
                ?>"
					rel="bookmark"><?php
                echo $article[$articleTable->title];
                ?></a>
			</h2>
			<div class="postauthor">
				<p>
                <?php
                $author = $article[$articleTable->author] == 0 ? 'iLOVE' : $article[$articleTable->author];
                ?>
                    Posted by <a
						href="<?php echo APPLICATION_URL; ?>/author/index/author/<?php echo $article[$articleTable->author]; ?>"
						title="Posts by <?php
                echo $this->getAuthor($author);
                ?>"
						rel="author"><?php
                echo $this->getAuthor($author);
                ?></a> on <?php
                echo $article[$articleTable->ctime];
                ?> &middot;
                </p>
			</div>
<?php
                if (! empty($article[$articleTable->coverimage])) {
                    ?>
<a class="thumbnail"
				href="<?php
                    echo APPLICATION_URL;
                    ?>/article/index/p/<?php
                    echo $article[$articleTable->id];
                    ?>"
				rel="bookmark"><img width="650"
				src="<?php
                    echo $article[$articleTable->coverimage];
                    ?>"
				class="attachment-category-thumbnail wp-post-image"
				alt="<?php
                    echo $article[$articleTable->title];
                    ?>"
				title="<?php
                    echo $article[$articleTable->title];
                    ?>" /></a>
<?php
                }
                ?>
<p>
                <?php
                echo $article[$articleTable->description];
                ?>
            </p>
            <?php
                if ($article[$articleTable->type] == $typeMap->music) {
                    $urlArr = json_decode($article[$articleTable->url], true);
                    // 为了js里面使用，把所有的音乐加入队列中
                    if (isset($urlArr['local'])) {
                        $localLen = count($urlArr['local']);
                        for ($i = 0; $i < $localLen; $i++) {
                            $localMusic[] = $urlArr['local'][$i];
                        ?>
<p class="audioplayer_container" style="height: 30px;">
				<span
					style="display: block; padding: 5px; border: 1px solid #dddddd; background: #f8f8f8"
					id="audioplayer_<?php echo $audioPlayerCount; ?>">Audio clip: Adobe
					Flash Player (version 9 or above) is required to play this audio
					clip. Download the latest version <a
					href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&amp;promoid=BIOW"
					title="Download Adobe Flash Player">here</a>. You also need to have
					JavaScript enabled in your browser.
				</span>
			</p>
<?php
                            $audioPlayerCount ++;
                        }
                    }
                    
                    if (isset($urlArr['remote'])) {
                        $remoteLen = count($urlArr['remote']);
                        for ($i = 0; $i < $remoteLen; $i++) {
                            echo $urlArr['remote'][$i];
                        }
                    }
                }
                ?>
<div style="clear: both;"></div>
			<div class="postmeta">
				<p><?php echo $article[$articleTable->keywords];?></p>
			</div>
		</div>
        <?php
            } else {
                ?>
<div class="post clearfix">
			<div class="entry clearfix">
				<h2>
					<a
						href="<?php echo APPLICATION_URL; ?>/article/index/p/<?php echo $article[$articleTable->id]?>"
						rel="bookmark" title="<?php echo $article[$articleTable->title]?>"><?php echo $article[$articleTable->title]?></a>
				</h2>
				<a id="dd_start"></a>
				<p>
					<a
						href="<?php echo APPLICATION_URL; ?>/article/index/p/<?php echo $article[$articleTable->id]?>">
						<span class="pibfi_pinterest"> <img
							class="alignleft size-medium wp-image-309"
							src="<?php echo APPLICATION_URL . $article[$articleTable->coverimage]?>"
							alt="<?php echo $article[$articleTable->title]?>" width="300"
							height="388">
					</span>
					</a>
				</p>
				<p style="text-align: right;">
					<span class="pibfi_pinterest"> <img class="size-large wp-image-300"
						title="line"
						src="<?php echo APPLICATION_PUBLIC; ?>/images/line-1024x15.png"
						alt="" width="314" height="13">
					</span>
				</p>
				<p style="text-align: justify; padding-left: 336px;">
				<?php echo $article[$articleTable->description]?>
			</p>
				<a id="dd_end"></a>
			</div>
		</div>
		<div class="postdate clearfix">
			<div class="left">
				<a href="<?php echo APPLICATION_URL; ?>/author/index/author/<?php echo $article[$articleTable->author]; ?>"
					title="Posts by <?php echo $this->getAuthor($article[$articleTable->author]); ?>"
					rel="author"><?php echo $this->getAuthor($article[$articleTable->author]); ?></a> |
			<?php echo date('M d, Y', strtotime($article[$articleTable->ctime]));?>
		</div>
			<div class="right">
				<a class="more-link"
					href="<?php echo APPLICATION_URL; ?>/article/index/p/<?php echo $article[$articleTable->id]?>"
					rel="bookmark" title="<?php echo $article[$articleTable->title]?>">More</a>
			</div>
		</div>
<?php
            }
        }
        ?>
        
        <?php
        echo $this->render('common/pagination.phtml');
        ?>
        
    </div>
	<div id="sidebar_right">
		<div class="col2">
<?php
echo $this->render('common/most-viewed-slider.phtml');
?>
</div>
<?php
echo $this->render('common/tags-cloud.phtml');
?>
<?php
echo $this->render('common/view-by-date.phtml');
?>
</div>
	<div style="clear: both;"></div>
</div>
<?php
if ($type == $typeMap->music || $type == $typeMap->mix) {
    ?>
<script type="text/javascript">
    <?php
    for ($i = 0; $i < count($localMusic); $i ++) {
        ?>
    AudioPlayer.embed("audioplayer_<?php echo $i + 1; ?>",
	{
		titles:"<?php echo $localMusic[$i]['title']; ?>",
		soundFile:"<?php
        echo $this->encodeMusic(APPLICATION_URL . $localMusic[$i]['url']);
        ?>"
	});
    <?php
    }
    ?>
</script>
<?php
}
?>
<!-- close #wrap div -->